#version 460
#extension GL_GOOGLE_include_directive : enable

#include "../../../../core/shader_widget_color.h"
#include "../../../../core/shader_color.h"


layout(location = 0) in vec2 vUV;
layout(location = 1) in flat uint gInstanceIndex;
layout(location = 2) in flat float gap;
layout(location = 3) in flat float offset;

layout(location=0) out vec4 outColor;


layout(std430, column_major, binding = DEF_BINDING_WIDGET_LineProp) readonly buffer U_Matrix_5 {
	S_LineProp LineProp[];
};


void main(void){
	uint k = uint( (vUV.y + offset) / gap);
	//float k = int(mod(vUV.y, gap)) / gap;
	//float k = vUV.y - (int(vUV.y/gap) * gap);
	//outColor = vec4(0, round(k), 0, 1);
	float a = fract((floor((vUV.y - offset) / gap)) / 2) * 2;
	
	vec4 vColorA = f_glsl_buildColor(LineProp[gInstanceIndex].m_ColorA);
	vec4 vColorB = f_glsl_buildColor(LineProp[gInstanceIndex].m_ColorB);
	outColor = mix(vColorA, vColorB, a);
	return;
	
	if ((k&1) == 0) {
		
		outColor = vColorA;
	}else{
		
		outColor = vColorB;
	}
	outColor.a = 1;
	//outColor = vec4(k*0.01, 0, 0, 1);
}


 